#region MIT Licence
/*
 * Copyright (C) 2014 PdfCreative
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
 * and associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom 
 * the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included 
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#endregion

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace PdfCreative.Pdf.Writer.Fonts
{
    /// <summary>
    /// The FontInfo class is the abstract base class for all font information classes. The FontInfo class allows the Writer and
    /// other clients to extract font information and map characters to glyph details.
    /// Implementers of this class are TrueTypeFontInfo and Type1FontInfo.
    /// </summary>
    public abstract class FontInfo
    {
        // Public properties
        // =================
        #region Public properties
        /// <summary>
        /// Retrieves the font's ascent
        /// </summary>
        public abstract int Ascent
        {
            get;
        }

        /// <summary>
        /// Retrieves the height of capitals in this font
        /// </summary>
        public abstract int CapHeight
        {
            get;
        }

        /// <summary>
        /// Retrieves the descent of this font.
        /// </summary>
        public abstract int Descent
        {
            get;
        }

        /// <summary>
        /// Retrieves the font's flags as demanded by the PDF specification.
        /// </summary>
        public abstract int Flags
        {
            get;
        }

        /// <summary>
        /// Retrieves the italic angle.
        /// </summary>
        public abstract decimal ItalicAngle
        {
            get;
        }

        /// <summary>
        /// Retrieves the postscript name of the font.
        /// </summary>
        public abstract string PostscriptName
        {
            get;
        }

        /// <summary>
        /// Retrieves the size of vertical stems in the font.
        /// </summary>
        public abstract int StemV
        {
            get ;
        }

        /// <summary>
        /// Retrieves the number of units per Em-point that is used in the font file.
        /// </summary>
        public abstract int UnitsPerEm
        {
            get;
        }

        /// <summary>
        /// Retrieves the right-most boundary of the font's bounding-box.
        /// </summary>
        public abstract int XMax
        {
            get;
        }

        /// <summary>
        /// Retrieves the left-most boundary of the font's bounding-box.
        /// </summary>
        public abstract int XMin
        {
            get;
        }

        /// <summary>
        /// Retrieves the upper boundary of the font's bounding-box.
        /// </summary>
        public abstract int YMax
        {
            get;
        }

        /// <summary>
        /// Retrieves the lower boundary of the font's bounding-box.
        /// </summary>
        public abstract int YMin
        {
            get;
        }
        #endregion



        // Public methods
        // ==============
        #region Public methods
        /// <summary>
        /// Retrieves the width of the specified character.
        /// </summary>
        /// <param name="ch">The character</param>
        /// <returns>The width of the character</returns>
        public abstract int GetCharacterWidth(char ch);
       
        /// <summary>
        /// Parses the font file.
        /// </summary>
        /// <param name="filename">The name of the file to parse</param>
        public abstract void Parse(string filename);

        /// <summary>
        /// Parses the data contained in the stream. The stream must support seeking and data will be read from
        /// the start of the stream.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        public abstract void Parse(Stream stream);

        /// <summary>
        /// Parses the headers of the font file. The requirement for this is that the font's name is read. No
        /// other data is required to be read.
        /// </summary>
        /// <param name="filename">The name of the file to parse</param>
        public abstract void ParseHeaders(string filename);

        /// <summary>
        /// Parses the data contained in the stream. The stream must support seeking and data will be read from
        /// the start of the stream. Only the font's headers are read.
        /// The requirement for this is that the font's name is read. No
        /// other data is required to be read.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        public abstract void ParseHeaders(Stream stream);
        #endregion

    } // FontInfo class
}
